package web;

import org.crh.common.response.impl.RuntimeResponse;
import org.crh.payment.PaymentService;
import org.crh.payment.domain.PaymentReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/payment")
public class PaymentController {
    @Autowired
    private PaymentService paymentService;

    @PostMapping("/pay")
    public ResponseEntity<RuntimeResponse> pay(@RequestBody PaymentReq paymentReq) {
        return paymentService.processPayment(paymentReq);
    }
}
